package com.cg.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;

import com.cg.utils.FilterRule;

/**
 * 基础Dao(还需在XML文件里，有对应的SQL语句)
 * 
 */
public interface BaseDao<T> {

	void save(T t);

	void save(Map<String, Object> map);

	void saveBatch(List<T> list);

	int update(T t);

	int update(Map<String, Object> map);

	int delete(Object id);

	int delete(Map<String, Object> map);

	int deleteBatch(Object[] id);

	T queryObject(Object id);

	List<T> queryList(Map<String, Object> map);

	List<T> queryList(Object id);

	int queryTotal(Map<String, Object> map);

	int queryTotal();

	public int updateByCondition(@Param("updateFields") Map<String, Object> updateFields,
			@Param("filterRules") List<FilterRule> filterRules);

	public List<T> findAll();

	public List<T> findByCondition(@Param("filterRules") List<FilterRule> filterRules);

	public List<T> findLimit(int firstResult, int maxResults);

	public List<T> findLimitByCondition(@Param("filterRules") List<FilterRule> filterRules, int firstResult,
			int maxResults);

	public Long findCount();

	public Long findCountByCondition(@Param("filterRules") List<FilterRule> filterRules);
}
